import java.util.Arrays;

public class Learn19 {
    public static String func(int[] array,int key){
        String ret = "";
        for (int i = 0; i < array.length ; i++) {
            for (int j = i + 1; j < array.length ; j++) {       //两个指针就行了
                if(array[i] + array[j] ==key){
                    ret = ret +"["+i+","+j+"]";
                    return ret;             //返回值是数组好
                }
            }
        }
        return "没有！";
    }


    public static void main(String[] args) {
        int[] array = new int[]{2,7,11,15};        //两数之和
        String str = func(array,9);
        System.out.println(str);
    }
}
